home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / HyperGraphEdMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  41.3 KB  |  1,338 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. // $Source: /vobs/aw/Maya/src/ExplorerSlice/UI/HyperGraphEdMenu.mel $
  19. // 
  20. // $Author: jgross $
  21. // $Revision: /main/102 $
  22. // $Date: 2000/04/12 14:27:10 $
  23. // 
  24.  
  25. source hyperViewer;
  26.  
  27.  
  28. //
  29. // DAG or DG Level check 
  30. //
  31. // Executing the actual commands for the chosen options as well as
  32. // all checking to keep the option menus and the buttons in sync
  33. //
  34. global proc checkHGControls(string $editor)
  35. {
  36.     string $graphType = `hyperGraph -q -graphType $editor`; 
  37.     int $value, $showDGoptions;
  38.  
  39.     if ($graphType == "DG") { $value = 0; } 
  40.     if ($graphType == "DAG") { $value = 1; }
  41.     $showDGoptions = !$value;
  42.  
  43.     // check all the buttons in the iconBar of the Hypergraph
  44.     iconTextButton -e -en $value frameHierButton;
  45.     iconTextButton -e -en $value frameBranchButton;
  46.     iconTextCheckBox -e -en $value freeformButton;
  47.     // check the node PopupMenu
  48.     if (`menuItem -exists FoldItem`)
  49.         { menuItem -e -en $value FoldItem; };
  50.     if (`menuItem -exists UnfoldItem`)
  51.         { menuItem -e -en $value UnfoldItem; };
  52.     if (`menuItem -exists UnfoldAllItem`)
  53.         { menuItem -e -en $value UnfoldAllItem; };
  54.  
  55.     if (`menuItem -exists FrameHierarchyItem`)
  56.         { menuItem -e -en $value FrameHierarchyItem; };
  57.     if (`menuItem -exists FrameBranchItem`)
  58.         { menuItem -e -en $value FrameBranchItem; };
  59.  
  60.     // check for freeform mode options
  61.     //
  62.     if (`hyperGraph -q -freeform $editor` && $graphType == "DAG") 
  63.         $inFreeform = 1;
  64.     else $inFreeform = 0;
  65.     if (`menuItem -exists loadImageItem`)
  66.         { menuItem -e -en $inFreeform loadImageItem; };
  67.  
  68.  
  69.  
  70.     // check for other menus
  71.  
  72.     // check the View Menu
  73.     if (`menuItem -exists nextViewItem`)
  74.         { menuItem -e -en $value nextViewItem; };
  75.     if (`menuItem -exists previousViewItem`)
  76.         { menuItem -e -en $value previousViewItem; };
  77.     if (`menuItem -exists frameHierarchyItem`)
  78.         { menuItem -e -en $value frameHierarchyItem; };
  79.     if (`menuItem -exists frameBranchItem`)
  80.         { menuItem -e -en $value frameBranchItem; };
  81.  
  82.     // check the Edit Menu
  83.     if (`menuItem -exists FoldAllItem`)
  84.         { menuItem -e -en $value FoldAllItem; };
  85.     if (`menuItem -exists UnfoldSelectedItem`)
  86.         { menuItem -e -en $value UnfoldSelectedItem; };
  87.     if (`menuItem -exists UnfoldAllItem`)
  88.         { menuItem -e -en $value UnfoldAllItem; };
  89.     if (`menuItem -exists UnfoldHiddenItem`)
  90.         { menuItem -e -en $value UnfoldHiddenItem; };
  91.     if (`menuItem -exists ResetFreeformItem`) { 
  92.         int $freeform = `hyperGraph -q -freeform $editor`; 
  93.         menuItem -e -en ($value && $freeform) ResetFreeformItem; 
  94.     }; 
  95.         
  96.         
  97.     if (`menuItem -exists ClearViewItem`)
  98.         { menuItem -e -en $showDGoptions ClearViewItem; };
  99.  
  100.     // check the graph menu
  101.     //
  102.     if (`menuItem -exists navHomeItem`)
  103.         { menuItem -e -en $showDGoptions navHomeItem; };
  104.     if (`menuItem -exists DoLayoutItem`)
  105.         { menuItem -e -en $showDGoptions DoLayoutItem; };
  106.  
  107.     // check the options menu
  108.     //
  109.     if (`menuItem -exists LayoutCascade`)
  110.         { menuItem -e -en $value LayoutCascade; };
  111.     if (`menuItem -exists FiltersItem`)
  112.         { menuItem -e -en $value FiltersItem; };
  113.  
  114.     // update menu options so that theyr reflect the current 
  115.     // state of the editor.
  116.     //
  117.     updateOptionsState($editor);
  118. }
  119.  
  120.  
  121. global proc showDAGLevel(string $editor)
  122. {
  123.     hyperGraph -e -navigateHome $editor;
  124.     checkHGControls $editor;
  125. }
  126.  
  127.  
  128. global proc showDGLevel(string $editor)
  129. {
  130.     hyperGraph -e -down  $editor;
  131.     checkHGControls $editor;
  132. }
  133.  
  134. //
  135. // Options
  136. //
  137. // Executing the actual commands for the chosen options as well as
  138. // all checking to keep the option menus and the buttons in sync
  139. //
  140. global proc checkUpdateSubMenu(string $value, string $collectionName, 
  141.                              string $editor)
  142. {
  143.     int $cbState;
  144.     if ($collectionName == "Menu") {
  145.         switch ($value) {
  146.             case "selection":
  147.                 $cbState = `menuItem -q -cb MenuUpdateSelectionItem`;
  148.                 hyperGraph -edit -updateSelection $cbState $editor;
  149.                 if (`menuItem -exists PopupUpdateSelectionItem`) {
  150.                     menuItem -e -cb $cbState PopupUpdateSelectionItem;
  151.                 }
  152.                 optionVar -intValue hypergraphUpdateSelection $cbState;
  153.                 break;
  154.             case "node":
  155.                 $cbState = `menuItem -q -cb MenuUpdateNodeAddedItem`;
  156.                 hyperGraph -edit -updateNodeAdded $cbState $editor;
  157.                 if (`menuItem -exists PopupUpdateNodeAddedItem`) {
  158.                     menuItem -e -cb $cbState PopupUpdateNodeAddedItem;
  159.                 }
  160.                 optionVar -intValue hypergraphUpdateNodeAdded $cbState;
  161.                 break;
  162.         }
  163.     }
  164.     else if ($collectionName == "Popup") {
  165.         switch ($value) {
  166.             case "selection":
  167.                 $cbState = `menuItem -q -cb PopupUpdateSelectionItem`;
  168.                 hyperGraph -edit -updateSelection $cbState $editor;
  169.                 if (`menuItem -exists MenuUpdateSelectionItem`) {
  170.                     menuItem -e -cb $cbState MenuUpdateSelectionItem;
  171.                 }
  172.                 optionVar -intValue hypergraphUpdateSelection $cbState;
  173.                 break;
  174.             case "node":
  175.                 $cbState = `menuItem -q -cb PopupUpdateNodeAddedItem`;
  176.                 hyperGraph -edit -updateNodeAdded $cbState $editor;
  177.                 if (`menuItem -exists MenuUpdateNodeAddedItem`) {
  178.                     menuItem -e -cb $cbState MenuUpdateNodeAddedItem;
  179.                 }
  180.                 optionVar -intValue hypergraphUpdateNodeAdded $cbState;
  181.                 break;
  182.         }
  183.     }
  184.  
  185. }
  186.  
  187. //
  188. // Options
  189. //
  190. // Executing the actual commands for the chosen options as well as
  191. // all checking to keep the option menus and the buttons in sync
  192. //
  193. global proc checkShowSubMenu(string $value, string $collectionName, 
  194.                              string $editor)
  195. {
  196.     int $cbState;
  197.     if ($collectionName == "Menu") {
  198.         switch ($value) {
  199.             case "shape":
  200.                 $cbState = `menuItem -q -cb MenuShapeNodesItem`;
  201.                 hyperGraph -edit -showShapes $cbState $editor;
  202.                 if (`menuItem -exists PopupShapeNodesItem`) {
  203.                     menuItem -e -cb $cbState PopupShapeNodesItem;
  204.                 }
  205.                 optionVar -intValue hypergraphDisplayShapeNodes $cbState;
  206.                 break;
  207.             case "invisible":
  208.                 $cbState = `menuItem -q -cb MenuInvisibleNodesItem`;
  209.                 hyperGraph -edit -showInvisible $cbState $editor;
  210.                 if (`menuItem -exists PopupInvisibleNodesItem`) {
  211.                     menuItem -e -cb $cbState PopupInvisibleNodesItem;
  212.                 }
  213.                 optionVar -intValue hypergraphDisplayInvisibleNodes $cbState;
  214.                 break;
  215.             case "expressions":
  216.                 $cbState = `menuItem -q -cb MenuExpressionsItem`;
  217.                 hyperGraph -edit -showExpressions $cbState $editor;
  218.                 if (`menuItem -exists PopupExpressionsItem`) {
  219.                     menuItem -e -cb $cbState PopupExpressionsItem;
  220.                 }
  221.                 optionVar -intValue hypergraphDisplayExpressions $cbState;
  222.                 break;
  223.             case "constraints":
  224.                 $cbState = `menuItem -q -cb MenuConstraintsItem`;
  225.                 hyperGraph -edit -showConstraints $cbState $editor;
  226.                 if (`menuItem -exists PopupConstraintsItem`) {
  227.                     menuItem -e -cb $cbState PopupConstraintsItem;
  228.                 }
  229.                 optionVar -intValue hypergraphDisplayConstraints $cbState;
  230.                 break;
  231.             case "deformers":
  232.                 $cbState = `menuItem -q -cb MenuDeformersItem`;
  233.                 hyperGraph -edit -showDeformers $cbState $editor;
  234.                 if (`menuItem -exists PopupDeformersItem`) {
  235.                     menuItem -e -cb $cbState PopupDeformersItem;    
  236.                 }
  237.                 optionVar -intValue hypergraphDisplayDeformers $cbState;
  238.                 break;
  239.             case "image":
  240.                 $cbState = `menuItem -q -cb MenuImageEnabledItem`;
  241.                 hyperGraph -edit -imageEnabled$cbState $editor;
  242.                 if (`menuItem -exists PopupImageEnabledItem`) {
  243.                     menuItem -e -cb $cbState PopupImageEnabledItem;
  244.                 }
  245.                 optionVar -intValue hypergraphDisplayImage $cbState;
  246.                 break;
  247.             case "underworld":
  248.                 $cbState = `menuItem -q -cb MenuUnderworldItem`;
  249.                 hyperGraph -edit -showUnderworld $cbState $editor;
  250.                 if (`menuItem -exists PopupDeformersItem`) {
  251.                     menuItem -e -cb $cbState PopupUnderworldItem;
  252.                 }
  253.                 optionVar -intValue hypergraphDisplayUnderworldNodes $cbState;
  254.                 break;
  255.         }
  256.     }
  257.     if ($collectionName == "Popup") {
  258.         switch ($value) {
  259.             case "shape":
  260.                 $cbState = `menuItem -q -cb PopupShapeNodesItem`;
  261.                 hyperGraph -edit -showShapes $cbState $editor;
  262.                 if (`menuItem -exists MenuShapeNodesItem`) {
  263.                     menuItem -e -cb $cbState MenuShapeNodesItem;
  264.                 }
  265.                 optionVar -intValue hypergraphDisplayShapeNodes $cbState;
  266.                 break;
  267.             case "invisible":
  268.                 $cbState = `menuItem -q -cb PopupInvisibleNodesItem`;
  269.                 hyperGraph -edit -showInvisible $cbState $editor;
  270.                 if (`menuItem -exists MenuInvisibleNodesItem`) {
  271.                     menuItem -e -cb $cbState MenuInvisibleNodesItem;
  272.                 }
  273.                 optionVar -intValue hypergraphDisplayInvisibleNodes $cbState;
  274.                 break;
  275.             case "expressions":
  276.                 $cbState = `menuItem -q -cb PopupExpressionsItem`;
  277.                 hyperGraph -edit -showExpressions $cbState $editor;
  278.                 if (`menuItem -exists MenuExpressionsItem`) {
  279.                     menuItem -e -cb $cbState MenuExpressionsItem;
  280.                 }
  281.                 optionVar -intValue hypergraphDisplayExpressions $cbState;
  282.                 break;
  283.             case "constraints":
  284.                 $cbState = `menuItem -q -cb PopupConstraintsItem`;
  285.                 hyperGraph -edit -showConstraints $cbState $editor;
  286.                 if (`menuItem -exists MenuConstraintsItem`) {
  287.                     menuItem -e -cb $cbState MenuConstraintsItem;
  288.                 }
  289.                 optionVar -intValue hypergraphDisplayConstraints $cbState;
  290.                 break;
  291.             case "deformers":
  292.                 $cbState = `menuItem -q -cb PopupDeformersItem`;
  293.                 hyperGraph -edit -showDeformers $cbState $editor;
  294.                 if (`menuItem -exists MenuDeformersItem`) {
  295.                     menuItem -e -cb $cbState MenuDeformersItem;
  296.                 }
  297.                 optionVar -intValue hypergraphDisplayDeformers $cbState;
  298.                 break;
  299.             case "image":
  300.                 $cbState = `menuItem -q -cb PopupImageEnabledItem`;
  301.                 hyperGraph -edit -imageEnabled $cbState $editor;
  302.                 if (`menuItem -exists MenuImageEnabledItem`) {
  303.                     menuItem -e -cb $cbState MenuImageEnabledItem;
  304.                 }
  305.                 optionVar -intValue hypergraphDisplayImage $cbState;
  306.                 break;
  307.             case "underworld":
  308.                 $cbState = `menuItem -q -cb PopupUnderworldItem`;
  309.                 hyperGraph -edit -showUnderworld $cbState $editor;
  310.                 if (`menuItem -exists MenuUnderworldItem`) {
  311.                     menuItem -e -cb $cbState MenuUnderworldItem;
  312.                 }
  313.                 optionVar -intValue hypergraphDisplayUnderworldNodes $cbState;
  314.                 break;
  315.         }
  316.     }
  317. }
  318.  
  319.  
  320. global proc checkOrientCollection(string $value, string $editor)
  321. {
  322.     if ($value == "horiz") {
  323.         hyperGraph -e -orientation horiz $editor;
  324.     } else {
  325.         hyperGraph -e -orientation vert $editor;
  326.     }
  327.     optionVar -sv hypergraphOrientation $value;
  328.         
  329.     if (`radioMenuItemCollection -exists ($editor + "OrientMenuCollection")`) {
  330.         menuItem -edit -rb 
  331.             (`hyperGraph -q -orientation $editor` == "horiz") MenuHorizItem;
  332.         menuItem -edit -rb 
  333.             (`hyperGraph -q -orientation $editor` == "vert") MenuVertItem;
  334.     }
  335.  
  336.     if (`radioMenuItemCollection -exists ($editor + "OrientPopupCollection")`) {
  337.         menuItem -edit -rb 
  338.             (`hyperGraph -q -orientation $editor` == "horiz") PopupHorizItem;
  339.         menuItem -edit -rb 
  340.             (`hyperGraph -q -orientation $editor` == "vert") PopupVertItem;
  341.     }
  342. }
  343.  
  344.  
  345.  
  346. global proc checkFreeformCollection(string $value, string $editor)
  347. {
  348.     if ($value == "On"){
  349.         hyperGraph -e -freeform true $editor;
  350.         iconTextCheckBox -edit -i1 "freeformOn.xpm" freeformButton;
  351.         optionVar -iv hypergraphFreeform 1;
  352.     } else {
  353.         hyperGraph -e -freeform false $editor;
  354.         iconTextCheckBox -edit -i1 "freeformOff.xpm" freeformButton;
  355.         optionVar -iv hypergraphFreeform 0;
  356.     }
  357.         
  358.     if (`radioMenuItemCollection -exists ($editor + "FreeformMenuCollection")`) {
  359.         menuItem -edit -rb 
  360.             (`hyperGraph -q -freeform $editor`) MenuFreeformOnItem;
  361.         menuItem -edit -rb 
  362.             (`hyperGraph -q -freeform $editor` == false) MenuFreeformOffItem;
  363.     }
  364.  
  365.     if (`radioMenuItemCollection -exists ($editor + "FreeformPopupCollection")`) {
  366.         menuItem -edit -rb 
  367.             (`hyperGraph -q -freeform $editor`) PopupFreeformOnItem;
  368.         menuItem -edit -rb 
  369.             (`hyperGraph -q -freeform $editor` == false) PopupFreeformOffItem;
  370.     }
  371.     iconTextCheckBox -edit -value (`hyperGraph -q -freeform $editor`)
  372.             freeformButton;
  373. }
  374. global proc checkFramesMenuItems ( string $editor )
  375. {
  376.     menuItem -e -cb (`hyperGraph -q -animateTransition $editor`) 
  377.         animateTransitions;
  378.  
  379.     if (`radioMenuItemCollection -exists ($editor + "FramesMenuCollection")`) {
  380.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  381.             MenuFrame5Item;
  382.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  383.             MenuFrame10Item;
  384.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  385.             MenuFrame15Item;
  386.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  387.             MenuFrame20Item;
  388.     }
  389.     if (`radioMenuItemCollection -exists ($editor + "FramesPopupCollection")`) {
  390.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  391.             PopupFrame5Item;
  392.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  393.             PopupFrame10Item;
  394.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  395.             PopupFrame15Item;
  396.         menuItem -e -en (`hyperGraph -q -animateTransition $editor`) 
  397.             PopupFrame20Item;
  398.     }
  399.  
  400. }
  401.  
  402. global proc checkAnimateTransitions ( string $editor )
  403. {
  404.     if (`hyperGraph -q -animateTransition $editor`) {
  405.         hyperGraph -e -animateTransition false $editor;
  406.     } else {
  407.         hyperGraph -e -animateTransition true $editor;
  408.     }
  409.     
  410.     checkFramesMenuItems $editor;
  411. }
  412.  
  413.  
  414. global proc checkFramesCollection (int $value, string $editor )
  415. {
  416.     hyperGraph -e -transitionFrames $value $editor;
  417.     
  418.     if (`radioMenuItemCollection -exists ($editor + "FramesMenuCollection")`) {
  419.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 5) 
  420.             MenuFrame5Item;
  421.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 10)
  422.             MenuFrame10Item;
  423.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 15)
  424.             MenuFrame15Item;
  425.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 20)
  426.             MenuFrame20Item;
  427.     }
  428.     if (`radioMenuItemCollection -exists ($editor + "FramesPopupCollection")`) {
  429.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 5)
  430.             PopupFrame5Item;
  431.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 10)
  432.             PopupFrame10Item;
  433.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 15)
  434.             PopupFrame15Item;
  435.         menuItem -e -rb (`hyperGraph -q -transitionFrames $editor` == 20)
  436.             PopupFrame20Item;
  437.     }
  438. }
  439.  
  440.  
  441. global proc confirmResetFreeform(string $editor)
  442. {
  443.     string $value = `confirmDialog 
  444.                 -title "Confirm" 
  445.                 -message "Do you really want to reset the freeform layout?" 
  446.                 -messageAlign "center" 
  447.                 -button "Yes" -button "No"
  448.                 -cancelButton "No" -defaultButton "Yes"`;
  449.     if ($value == "Yes") {
  450.         hyperGraph -e -resetFreeform  $editor;
  451.     }
  452. }
  453.  
  454. global proc confirmClear(string $editor)
  455. {
  456.     string $value = `confirmDialog 
  457.                 -title "Confirm" 
  458.                 -message "Do you really want to clear your graph view ?" 
  459.                 -messageAlign "center" 
  460.                 -button "Yes" -button "No"
  461.                 -cancelButton "No" -defaultButton "Yes"`;
  462.     if ($value == "Yes") {
  463.         hyperGraph -e -clear  $editor;
  464.     }    
  465. }
  466.  
  467. global proc confirmLayout(string $editor)
  468. {
  469.     string $value = `confirmDialog 
  470.                 -title "Confirm" 
  471.                 -message "Do you want to re-layout the current graph ?" 
  472.                 -messageAlign "center" 
  473.                 -button "Yes" -button "No"
  474.                 -cancelButton "No" -defaultButton "Yes"`;
  475.     if ($value == "Yes") {
  476.         hyperGraph -e -layout  $editor;
  477.     }    
  478. }
  479.  
  480. global proc int loadImageCallback ( string $theFile, string $theFileType )
  481. {
  482.     // Optional retaining of the new directory.
  483.     string $currentDir = `workspace -q -dir`;
  484. //    retainWorkingDirectory $currentDir;
  485.     
  486.     // Do stuff with $theFile
  487.     string $typeList[] = `file -q -type $theFile`;
  488.     if (size($typeList) > 0 && $typeList[0] == "image")
  489.     {
  490.         hyperGraph -e -image $theFile hyperGraphPanel1HyperGraphEd;
  491.         hyperGraph -e -imageEnabled true hyperGraphPanel1HyperGraphEd;
  492.     }
  493.     else
  494.     {
  495.         confirmDialog 
  496.                 -title "Error" 
  497.                 -message "File type must be an image." 
  498.                 -messageAlign "center" 
  499.                 -button "OK"
  500.                 -defaultButton "OK";
  501.     }
  502.     return 1;
  503. }
  504.  
  505. global proc loadImage(string $editor)
  506. {
  507.     $myWorkspace = `workspace -q -fn`;
  508.     setWorkingDirectory($myWorkspace, "image", "images");
  509.     fileBrowser loadImageCallback "Load Image" "image" 0;
  510. }
  511.  
  512.  
  513. //
  514. // Menus
  515. //
  516. // Create the different menus, but only create them when they are needed
  517. // (dynamically build menus), and hook them up.
  518. // create and destroy the RMB menu as soon as you hit two different hit areas
  519. // the hyperPanel background and a node create different menus. 
  520. // The menuItem creation is used by the popupMenu as well as the menuBarLayout.
  521. //
  522. global proc buildHyperEditMenu(string $editor, string $parent )
  523. {    
  524.     setParent -m $parent;
  525.  
  526.     if (`menu -query -numberOfItems $parent` != 0) {
  527.         checkHGControls $editor;
  528.         return;
  529.     }
  530.  
  531.     menuItem -l "Rename" RenameItem;
  532.     menuItem -divider true;
  533.     menuItem -l "Collapse" FoldAllItem;
  534.     menuItem -l "Expand" UnfoldSelectedItem;
  535.     menuItem -l "Expand All" UnfoldAllItem;
  536.     menuItem -l "Show Selected" UnfoldHiddenItem;
  537.     menuItem -divider true;
  538.     menuItem -l "Reset Freeform Layout" ResetFreeformItem;
  539.     menuItem -l "Clear View" ClearViewItem;
  540.     menuItem -divider true;
  541.     menuItem -l "Attributes..." SingleAttrEditorItem;
  542.  
  543.     checkHGControls $editor;
  544.  
  545.     //
  546.     // hook ups for the EditMenuItems
  547.     //
  548.     menuItem -edit -c ("hyperGraph -e -rename " + $editor)
  549.         RenameItem;
  550.     menuItem -edit -c ("hyperGraph -e -fold " + $editor) 
  551.         FoldAllItem;
  552.     menuItem -edit -c ("hyperGraph -e -unfold " + $editor) 
  553.         UnfoldSelectedItem;
  554.     menuItem -edit -c ("hyperGraph -e -unfoldAllShapes " + $editor) 
  555.         UnfoldAllItem;
  556.     menuItem -edit -c ("hyperGraph -e -unfoldHidden " + $editor)
  557.         UnfoldHiddenItem;
  558.     menuItem -edit -c ("hyperGraph -e -attributeEditor single " + $editor)
  559.         SingleAttrEditorItem;
  560.     menuItem -edit -c ("confirmResetFreeform " + $editor)
  561.         ResetFreeformItem;
  562.     menuItem -edit -c ("confirmClear " + $editor)
  563.         ClearViewItem;
  564. }
  565.  
  566.  
  567. global proc buildHyperViewMenu (string $editor, string $parent)
  568. {    
  569.     setParent -menu $parent;
  570.     if (`menu -query -numberOfItems $parent` != 0) {
  571.         checkHGControls $editor;
  572.         return;
  573.     }
  574.  
  575.     menuItem -l "Previous View" previousViewItem;
  576.     menuItem -l "Next View" nextViewItem;
  577.     menuItem -divider true;
  578.     menuItem -l "Frame All" ZoomOutItem;
  579.     menuItem -l "Frame Selection" frameSelectionItem;
  580.     menuItem -l "Frame Hierarchy" frameHierarchyItem;
  581.     menuItem -l "Frame Branch" frameBranchItem;
  582.     menuItem -divider true;
  583.     menuItem -l "Load Background Image..." loadImageItem;
  584.     
  585.     checkHGControls $editor;
  586.  
  587.     //
  588.     // hook up the ViewMenuItems
  589.     //
  590.  
  591.     menuItem -edit -c ("hyperGraph -e -previousView " + $editor) 
  592.         previousViewItem;
  593.     menuItem -edit -c ("hyperGraph -e -nextView " + $editor) 
  594.         nextViewItem;
  595.     
  596.     menuItem -edit -c ("FrameSelected") 
  597.         frameSelectionItem;
  598.     menuItem -edit -c ("FrameAll") 
  599.         ZoomOutItem;
  600.     menuItem -edit -c ("hyperGraph -e -frameHierarchy " + $editor) 
  601.         frameHierarchyItem;
  602.     menuItem -edit -c ("hyperGraph -e -frameBranch " + $editor) 
  603.         frameBranchItem; 
  604.     menuItem -edit -c ("loadImage " + $editor) 
  605.         loadImageItem; 
  606. }
  607.  
  608.  
  609. global proc buildHyperNavigateMenu(string $editor, string $parent)
  610. {    
  611.     int $dimWhenNoSelect = 0;
  612.  
  613.     setParent -menu $parent;
  614.     if (`menu -query -numberOfItems $parent` != 0) {
  615.         return;
  616.     }
  617.  
  618.     menuItem -l "Scene Hierarchy" navHomeItem;
  619.     menuItem -divider true;
  620.     menuItem -label "Input and Output Connections" allConnectionsItem;
  621.     menuItem -label "Input Connections" upstreamItem;
  622.     menuItem -label "Output Connections" downstreamItem;
  623.     menuItem -divider true;
  624.     menuItem -l "Layout" DoLayoutItem;
  625.     menuItem -divider true;    
  626.     menuItem -l "Rebuild" RebuildItem;
  627.  
  628.     //
  629.     //  hook up all the NavigateMenuItems
  630.     //
  631.     menuItem -edit -c 
  632.         ("hyperGraph -e -navigateHome " + $editor + "; " +
  633.          "checkHGControls " + $editor) 
  634.         navHomeItem;
  635.     menuItem -edit -c 
  636.         ("hyperGraph -e -down " + $editor + "; " +
  637.          "checkHGControls " + $editor + "; ")
  638.         allConnectionsItem;
  639.     menuItem -edit -c 
  640.         ("hyperGraph -e -upstream " + $editor + "; " +
  641.          "checkHGControls " + $editor + "; ")
  642.         upstreamItem;
  643.     menuItem -edit -c 
  644.         ("hyperGraph -e -downstream " + $editor + "; " +
  645.          "checkHGControls " + $editor + "; " )
  646.         downstreamItem;
  647.     menuItem -edit -c 
  648.         ("confirmLayout " + $editor) 
  649.         DoLayoutItem;
  650.  
  651.     menuItem -edit -c ("hyperGraph -e -rebuild " + $editor) RebuildItem;
  652.  
  653.     checkHGControls $editor;
  654.     if ($dimWhenNoSelect) {
  655.         dimWhen -f "SomethingSelected" allConnectionsItem;
  656.         dimWhen -f "SomethingSelected" upstreamItem;
  657.         dimWhen -f "SomethingSelected" downstreamItem;
  658.     }
  659. }
  660.  
  661. global proc checkInterestingNodeName ( string $nodeType, string $editor )
  662. {
  663.     if ($nodeType == "renderPartition"){
  664.         string $renderPartitionName = `renderPartition -q`;
  665.         hyperGraph -e -dn $renderPartitionName $editor; 
  666.         hyperGraph -e -frameGraph $editor;
  667.     } else {
  668.         string $nodeTypeNames[] = `ls -type $nodeType`;
  669.         hyperGraph -e -dn $nodeTypeNames[0] $editor; 
  670.         hyperGraph -e -frameGraph $editor;
  671.     }
  672.  
  673. }
  674.  
  675. global proc buildHyperRenderingMenu(string $editor, string $parent)
  676. {    
  677.     setParent -menu $parent;
  678.     if (`menu -query -numberOfItems $parent` != 0) {
  679.         return;
  680.     }
  681.  
  682.     menuItem -l "Show ShadingGroups" showShadGroupItem;
  683.     menuItem -l "Show Materials" showShadersItem;
  684.     menuItem -l "Show Textures" showTexturesItem;
  685.     menuItem -l "Show Lights" showLightsItem;
  686.     menuItem -divider true;
  687.     menuItem -l "Create Render Node..." createRendNodeItem;
  688.  
  689.     //
  690.     // Hook up all the RenderingMenuItems
  691.     //
  692.  
  693.     menuItem -edit -c ("checkInterestingNodeName renderPartition " + $editor
  694.         + ";checkHGControls " + $editor) showShadGroupItem;
  695.     menuItem -edit -c ("checkInterestingNodeName defaultShaderList " + $editor
  696.         + ";checkHGControls " + $editor) showShadersItem;
  697.     menuItem -edit -c ("checkInterestingNodeName defaultTextureList " + $editor
  698.         + ";checkHGControls " + $editor) showTexturesItem;
  699.     menuItem -edit -c ("checkInterestingNodeName lightList " + $editor
  700.         + ";checkHGControls " + $editor) showLightsItem;
  701.     menuItem -edit -c 
  702.         ("createRenderNode \"-all\" \"\" \"\" ") createRendNodeItem;
  703. }
  704.  
  705.  
  706. global proc buildHyperShowSubMenu(
  707.     string $editor,
  708.     string $parent,
  709.     string $collectionName)
  710. //
  711. //    Description:
  712. //        Build the contents of the Options > Display menu.
  713. //
  714. {    
  715.     setParent -menu $parent;
  716.  
  717.     //    Check if the menu items have already been created.
  718.     //
  719.     if (`menu -query -numberOfItems $parent` != 0) {
  720.         return;
  721.     }
  722.  
  723.     menuItem -label "Shape Nodes" 
  724.         -checkBox `hyperGraph -query -showShapes $editor` 
  725.         ($collectionName + "ShapeNodesItem");
  726.     menuItem -label "Hidden Nodes" 
  727.         -checkBox `hyperGraph -query -showInvisible $editor` 
  728.         ($collectionName + "InvisibleNodesItem");
  729.     menuItem -label "Underworld Nodes" 
  730.         -checkBox `hyperGraph -query -showUnderworld $editor` 
  731.         ($collectionName + "UnderworldItem");
  732.  
  733.     menuItem -divider true;
  734.  
  735.     menuItem -label "Expression Connections" 
  736.         -checkBox `hyperGraph -query -showExpressions $editor` 
  737.         ($collectionName + "ExpressionsItem");
  738.     menuItem -label "Constraint Connections" 
  739.         -checkBox `hyperGraph -query -showConstraints $editor` 
  740.         ($collectionName + "ConstraintsItem");
  741.     menuItem -label "Deformer Connections" 
  742.         -checkBox `hyperGraph -query -showDeformers $editor` 
  743.         ($collectionName + "DeformersItem");
  744.  
  745.     menuItem -divider true;
  746.  
  747.     menuItem -label "Background Image (In Freeform Layout)" 
  748.         -checkBox `hyperGraph -query -imageEnabled $editor`
  749.         ($collectionName + "ImageEnabledItem");
  750.  
  751.     menuItem -edit -command
  752.         ("checkShowSubMenu shape " + $collectionName + " " + $editor)
  753.         ($collectionName + "ShapeNodesItem");
  754.     menuItem -edit -command 
  755.         ("checkShowSubMenu underworld " + $collectionName + " " + $editor)
  756.         ($collectionName + "UnderworldItem");
  757.     menuItem -edit -command
  758.         ("checkShowSubMenu invisible " + $collectionName + " " + $editor)
  759.         ($collectionName + "InvisibleNodesItem");
  760.     menuItem -edit -command
  761.         ("checkShowSubMenu expressions " + $collectionName + " " + $editor)
  762.         ($collectionName + "ExpressionsItem");
  763.     menuItem -edit -command
  764.         ("checkShowSubMenu constraints " + $collectionName + " " + $editor)
  765.         ($collectionName + "ConstraintsItem");
  766.     menuItem -edit -command
  767.         ("checkShowSubMenu deformers " + $collectionName + " " + $editor)
  768.         ($collectionName + "DeformersItem");
  769.     menuItem -edit -command
  770.         ("checkShowSubMenu image " + $collectionName + " " + $editor)
  771.         ($collectionName + "ImageEnabledItem");
  772. }
  773.  
  774. global proc buildHyperUpdateSubMenu(string $editor, string $parent, 
  775.                                   string $collectionName)
  776. {    
  777.     setParent -menu $parent;
  778.     if (`menu -query -numberOfItems $parent` != 0) {
  779.         return;
  780.     }
  781.  
  782.     menuItem -l "On Selection" 
  783.         -cb `hyperGraph -q -updateSelection $editor` 
  784.         ($collectionName + "UpdateSelectionItem");
  785.     menuItem -l "On Nodes Creation" 
  786.         -cb `hyperGraph -q -updateNodeAdded $editor` 
  787.         ($collectionName + "UpdateNodeAddedItem");
  788.  
  789.     menuItem -edit -c 
  790.         ("checkUpdateSubMenu selection " + $collectionName + " " + $editor)
  791.         ($collectionName + "UpdateSelectionItem");
  792.     menuItem -edit -c 
  793.         ("checkUpdateSubMenu node " + $collectionName + " " + $editor)
  794.         ($collectionName + "UpdateNodeAddedItem");
  795. }
  796.  
  797.  
  798. global proc buildHyperOrientationSubMenu(string $editor, string $parent, 
  799.                                          string $collectionName)
  800. {    
  801.     setParent -menu $parent;
  802.     if (`menu -query -numberOfItems $parent` != 0) {
  803.         return;
  804.     }
  805.  
  806.     string $orientCollection = 
  807.         ($editor + "Orient" + $collectionName + "Collection");
  808.  
  809.     radioMenuItemCollection $orientCollection;
  810.     menuItem -l "Horizontal" -rb 
  811.         (`hyperGraph -q -orientation $editor` == "horiz")  
  812.         ($collectionName + "HorizItem");
  813.     menuItem -l "Vertical" -rb 
  814.         (`hyperGraph -q -orientation $editor` == "vert")
  815.         ($collectionName + "VertItem");
  816.     
  817.     menuItem -edit -c 
  818.         ("checkOrientCollection horiz " + $editor) 
  819.         ($collectionName + "HorizItem");
  820.     menuItem -edit -c 
  821.         ("checkOrientCollection vert " + $editor) 
  822.         ($collectionName + "VertItem");
  823. }
  824.  
  825.  
  826. global proc buildHyperLayoutSubMenu(string $editor, string $parent, 
  827.                     string $collectionName)
  828. {    
  829.     setParent -menu $parent;
  830.     if (`menu -query -numberOfItems $parent` != 0) {
  831.         return;
  832.     }
  833.     string $freeformCollection = 
  834.         ($editor + "Freeform" + $collectionName + "Collection");
  835.  
  836.     radioMenuItemCollection $freeformCollection;        
  837.     menuItem -l "Freeform Layout" -rb 
  838.         (`hyperGraph -q -freeform $editor`)
  839.         ($collectionName + "FreeformOnItem");
  840.     menuItem -l "Automatic Layout" -rb 
  841.         (!`hyperGraph -q -freeform $editor`)
  842.         ($collectionName + "FreeformOffItem");
  843.  
  844.     //
  845.     //  Hook up the LayoutSubMenuItems
  846.     //    
  847.     menuItem -edit -c 
  848.         ("checkFreeformCollection On " + $editor)
  849.         ($collectionName + "FreeformOnItem");
  850.     menuItem -edit -c
  851.         ("checkFreeformCollection Off " + $editor)
  852.         ($collectionName + "FreeformOffItem");
  853.     
  854. }
  855.         
  856. global proc buildHyperTransitionsSubMenu (string $editor, string $parent,
  857.                     string $collectionName)
  858. {    
  859.     setParent -menu $parent;
  860.     if (`menu -query -numberOfItems $parent` != 0) {
  861.         checkFramesMenuItems $editor;
  862.         return;
  863.     }
  864.  
  865.     string $framesCollection = 
  866.         ($editor + "Frames" + $collectionName + "Collection");
  867.  
  868.     menuItem -l "AnimateTransitions" 
  869.         -cb (`hyperGraph -q -animateTransition $editor`) 
  870.         animateTransitions;
  871.  
  872.     menuItem -divider true  frameNumCascade;
  873.         radioMenuItemCollection $framesCollection;
  874.         menuItem -l " 5 Frames" -rb 
  875.             (`hyperGraph -q -transitionFrames $editor` == 5)
  876.             ($collectionName + "Frame5Item");
  877.         menuItem -l "10 Frames" -rb 
  878.             (`hyperGraph -q -transitionFrames $editor` == 10) 
  879.             ($collectionName + "Frame10Item");
  880.         menuItem -l "15 Frames" -rb 
  881.             (`hyperGraph -q -transitionFrames $editor` == 15)
  882.             ($collectionName + "Frame15Item");
  883.         menuItem -l "20 Frames" -rb 
  884.             (`hyperGraph -q -transitionFrames $editor` == 20)
  885.             ($collectionName + "Frame20Item");
  886.         setParent -m ..;
  887.  
  888.     //
  889.     //  Hook up the TransitionSubMenuItems
  890.     //
  891.     menuItem -edit -c 
  892.         ("checkAnimateTransitions " + $editor ) 
  893.         animateTransitions;
  894.  
  895.     menuItem -edit -c 
  896.         ("checkFramesCollection 5 " + $editor)
  897.         ($collectionName + "Frame5Item");
  898.     menuItem -edit -c 
  899.         ("checkFramesCollection 10 " + $editor) 
  900.         ($collectionName + "Frame10Item");
  901.     menuItem -edit -c 
  902.         ("checkFramesCollection 15 " + $editor)
  903.         ($collectionName + "Frame15Item");
  904.     menuItem -edit -c 
  905.         ("checkFramesCollection 20 " + $editor)
  906.         ($collectionName + "Frame20Item");
  907.  
  908.     checkFramesMenuItems $editor;
  909. }
  910.  
  911.  
  912. global proc buildHyperOptionsMenu(string $editor, string $parent, 
  913.                                   string $collectionName)
  914. {    
  915.     setParent -menu $parent;
  916.     if (`menu -query -numberOfItems $parent` != 0) {
  917.         checkHGControls $editor;
  918.         return;
  919.     }
  920.  
  921.     string $menuItem = 
  922.         `menuItem -l "Display" -subMenu true FiltersItem`;
  923.     menuItem -edit -postMenuCommand 
  924.         ("buildHyperShowSubMenu " + $editor + " " + $menuItem + " " + 
  925.          $collectionName) $menuItem;
  926.     setParent -menu ..;
  927.  
  928.     string $menuItem = 
  929.         `menuItem -l "Orientation" -subMenu true OrientCascade`;
  930.     menuItem -edit -postMenuCommand 
  931.         ("buildHyperOrientationSubMenu " + $editor + " " + $menuItem + " " + 
  932.          $collectionName) $menuItem;
  933.     setParent -menu ..;
  934.  
  935.     string $menuItem = 
  936.         `menuItem -l "Layout" -subMenu true LayoutCascade`;
  937.     menuItem -edit -postMenuCommand 
  938.         ("buildHyperLayoutSubMenu " + $editor + " " + $menuItem + " " + 
  939.          $collectionName) $menuItem;
  940.     setParent -menu ..;
  941.  
  942.     string $menuItem = 
  943.         `menuItem -l "Transitions" -subMenu true -cb true TransitionCascade`;
  944.     menuItem -edit -postMenuCommand 
  945.         ("buildHyperTransitionsSubMenu " + $editor + " " + $menuItem + " " + 
  946.          $collectionName) $menuItem;
  947.     setParent -menu ..;
  948.  
  949.     string $menuItem = 
  950.         `menuItem -l "Update" -subMenu true UpdateCascade`;
  951.     menuItem -edit -postMenuCommand 
  952.         ("buildHyperUpdateSubMenu " + $editor + " " + $menuItem + " " + 
  953.          $collectionName) $menuItem;
  954.     setParent -menu ..;
  955.     
  956.     checkHGControls $editor;
  957. }
  958.  
  959.  
  960. global proc buildMainPopupMenuItems(string $editor, string $menuName, 
  961.                                     string $collectionName) 
  962. {
  963.     setParent -m $menuName;
  964.     
  965.     if (`menu -query -numberOfItems $menuName` != 0) {
  966.         return;
  967.     }
  968.     menuItem -l "Hypergraph" HyperMenuTitleItem;
  969.     menuItem -divider true;    
  970.     menuItem -divider true;    
  971.  
  972.     string $menuItem = `menuItem -l "Edit" -subMenu true EditCascade`;
  973.     menuItem -edit -postMenuCommand 
  974.         ("buildHyperEditMenu " + $editor + " " + $menuItem) $menuItem;
  975.     setParent -menu ..;
  976.  
  977.     string $menuItem = `menuItem -l "View" -subMenu true ViewCascade`;
  978.     menuItem -edit -postMenuCommand 
  979.         ("buildHyperViewMenu " + $editor + " " + $menuItem) $menuItem;
  980.     setParent -menu ..;
  981.  
  982.     menuItem -divider true;
  983.  
  984.     string $menuItem = 
  985.         `menuItem -l "Bookmarks" -subMenu true -aob true ($collectionName + "bookmarksCascade")`;
  986.     menuItem -edit -postMenuCommand 
  987.         ("hyperBookmarkBuildMenu " + $editor + " " + $menuItem) $menuItem;
  988.     setParent -menu ..;
  989.  
  990.     menuItem -divider true;
  991.  
  992.     string $menuItem = 
  993.         `menuItem -l "Graph" -subMenu true dependencyGraph`;
  994.     menuItem -edit -postMenuCommand 
  995.         ("buildHyperNavigateMenu " + $editor + " " + $menuItem) $menuItem;
  996.     setParent -menu ..;
  997.  
  998.     string $menuItem = 
  999.         `menuItem -l "Rendering" -subMenu true renderingCascade`;
  1000.     menuItem -edit -postMenuCommand 
  1001.         ("buildHyperRenderingMenu " + $editor + " " + $menuItem) $menuItem;
  1002.     setParent -menu ..;
  1003.  
  1004.     menuItem -divider true;
  1005.  
  1006.     string $menuItem = 
  1007.         `menuItem -l "Options" -subMenu true hyperOptionsCascade`;
  1008.     menuItem -edit -postMenuCommand 
  1009.         ("buildHyperOptionsMenu " + $editor + " " + $menuItem + " " + 
  1010.          $collectionName) $menuItem;
  1011.     setParent -menu ..;
  1012.  
  1013.     //    Attach the filter menu to the popup menu.
  1014.     //
  1015.     filterUICreateMenu($editor, `setParent -query -menu`);
  1016. }
  1017.  
  1018.  
  1019. global proc buildHyperGraphMenu(string $editor, string $parent, 
  1020.                                 string $collectionName)
  1021. {
  1022. //    setParent $parent;
  1023.     
  1024.     string $menu = 
  1025.         `menu -l "Edit" 
  1026.         -familyImage "menuIconEdit.xpm" 
  1027.         EditCascade`;
  1028.     menu -edit -postMenuCommand 
  1029.         ("buildHyperEditMenu " + $editor + " " + $menu) $menu;
  1030.     setParent -menu ..;
  1031.  
  1032.     string $menu = 
  1033.         `menu -l "View" 
  1034.         -familyImage "menuIconView.xpm" 
  1035.         ViewCascade`;
  1036.     menu -edit -postMenuCommand 
  1037.         ("buildHyperViewMenu " + $editor + " " + $menu) $menu;
  1038.     setParent -menu ..;
  1039.  
  1040.     string $menu = 
  1041.         `menu -l "Bookmarks" 
  1042.         -familyImage "menuIconBookmarks.xpm"
  1043.         -aob true 
  1044.         ($collectionName + "bookmarksCascade")`;
  1045.     menu -edit -postMenuCommand 
  1046.         ("hyperBookmarkBuildMenu " + $editor + " " + $menu) $menu;
  1047.     setParent -menu ..;
  1048.  
  1049.     string $menu = 
  1050.         `menu -l "Graph" 
  1051.         -familyImage "menuIconGraph.xpm" 
  1052.         dependencyGraph`;
  1053.     menu -edit -postMenuCommand 
  1054.         ("buildHyperNavigateMenu " + $editor + " " + $menu) $menu;
  1055.     setParent -menu ..;
  1056.  
  1057.     string $menu = 
  1058.         `menu -l "Rendering"
  1059.         -familyImage "menuIconRender.xpm"
  1060.         renderingCascade`;
  1061.     menu -edit -postMenuCommand 
  1062.         ("buildHyperRenderingMenu " + $editor + " " + $menu) $menu;
  1063.     setParent -menu ..;
  1064.  
  1065.     string $menu = 
  1066.         `menu -l "Options" 
  1067.         -familyImage "menuIconOptions.xpm"
  1068.         hyperOptionsCascade`;
  1069.     menu -edit -postMenuCommand 
  1070.         ("buildHyperOptionsMenu " + $editor + " " + $menu + " " + 
  1071.          $collectionName) $menu;
  1072.     setParent -menu ..;
  1073.     
  1074.     //    Attach the filter menu to the menu bar.
  1075.     //
  1076.     filterUICreateMenu($editor, `setParent -query`);
  1077. }
  1078.  
  1079.  
  1080. //
  1081. //  Create the separate specified menu for the RMB on a node
  1082. //
  1083. proc createHGnodeMenuItems( string $editor, string $menu )
  1084. {
  1085.     setParent -m $menu;
  1086.     
  1087.     menuItem -l "Node" HyperMenuTitleItem;
  1088.     menuItem -divider true;    
  1089.     menuItem -divider true;    
  1090.  
  1091.     menuItem -l "Collapse" FoldItem;
  1092.     menuItem -l "Expand" UnfoldItem;
  1093.     menuItem -l "Expand All" UnfoldAllItem;
  1094.     menuItem -divider true;
  1095.     menuItem -l "Frame Hierarchy" FrameHierarchyItem;
  1096.     menuItem -l "Frame Branch" FrameBranchItem;
  1097.     menuItem -divider true;
  1098.     menuItem -l "Rename" RenameItem;
  1099.     menuItem -l "Attribute Editor..." SingleAttrEditorItem;
  1100.     menuItem -divider true;
  1101.     menuItem -l "Show" ShowItem;
  1102.     menuItem -l "Hide" HideItem;
  1103.     
  1104.     checkHGControls $editor;
  1105. }
  1106.  
  1107.  
  1108. //
  1109. // define context-sensitive node commands issued on highlight node
  1110. //
  1111. proc defineHGNodeMenuCommands(string $editor, string $menu)
  1112. {
  1113.     menuItem -edit -c 
  1114.         ("hyperGraph -e -useFeedbackList -fold " + $editor) 
  1115.         FoldItem;
  1116.     menuItem -edit -c 
  1117.         ("hyperGraph -e -useFeedbackList -unfold " + $editor) 
  1118.         UnfoldItem;
  1119.     menuItem -edit -c 
  1120.         ("hyperGraph -e  -unfoldAllShapes -useFeedbackList " + $editor) 
  1121.         UnfoldAllItem;
  1122.     menuItem -edit -c 
  1123.         ("hyperGraph -e -useFeedbackList -frameHierarchy " + $editor)
  1124.         FrameHierarchyItem;
  1125.     menuItem -edit -c 
  1126.         ("hyperGraph -e -useFeedbackList -frameBranch " + $editor)
  1127.         FrameBranchItem;
  1128.     menuItem -divider true;
  1129.  
  1130.     menuItem -edit -c 
  1131.         ("hyperGraph -e -rename -useFeedbackList " + $editor) 
  1132.         RenameItem;
  1133.     menuItem -edit -c 
  1134.         ("hyperGraph -e -attributeEditor single -useFeedbackList " + $editor)
  1135.         SingleAttrEditorItem;
  1136.     menuItem -divider true;
  1137.     menuItem -edit -c 
  1138.         ("hyperGraph -e -visibility on -useFeedbackList " + $editor) 
  1139.         ShowItem;
  1140.     menuItem -edit -c 
  1141.         ("hyperGraph -e -visibility off -useFeedbackList " + $editor) 
  1142.         HideItem;
  1143. }
  1144.  
  1145.  
  1146. //
  1147. // Hook up the buttons 
  1148. //
  1149. proc defineButtonCommands (string $editor)
  1150. {
  1151.     int $dimWhenNoSelect = 0;
  1152.  
  1153.     iconTextButton -edit -command ("FrameAll")
  1154.         frameGraphButton;
  1155.     iconTextButton -edit -command ("FrameSelected")
  1156.         frameSelectionButton;
  1157.     iconTextButton -edit -command ("hyperGraph -e -frameHierarchy " + $editor)
  1158.         frameHierButton;
  1159.     iconTextButton -edit -command ("hyperGraph -e -frameBranch " + $editor)
  1160.         frameBranchButton;
  1161.  
  1162.     iconTextButton -edit -command ("showDAGLevel " + $editor)
  1163.         showDAGButton;
  1164.     iconTextButton -edit -command ("showDGLevel " + $editor)
  1165.         showDGButton;
  1166.     if ($dimWhenNoSelect)
  1167.         dimWhen -f "SomethingSelected" showDGButton;
  1168.  
  1169.     iconTextButton -edit -command ("hyperBookmarkAddCallback " + $editor +
  1170.                                  " later")
  1171.         addBookmarkButton;
  1172.     iconTextButton -edit -command ("hyperViewer " + $editor)
  1173.         editBookmarkButton;
  1174.     
  1175.     iconTextCheckBox -edit 
  1176.         -onCommand ("checkFreeformCollection On " + $editor)
  1177.         -offCommand ("checkFreeformCollection Off " + $editor)
  1178.         freeformButton;
  1179. }
  1180.  
  1181.  
  1182. global proc buildHGNodeMenuItems(string $editor, string $menu)
  1183. {
  1184.     createHGnodeMenuItems($editor, $menu);
  1185.     defineHGNodeMenuCommands($editor, $menu);
  1186. }
  1187.  
  1188.  
  1189. global proc buildHGMenuItems(string $editor, string $menu, 
  1190.                            string $collectionName)
  1191. {
  1192.     if (`popupMenu -e -exists $menu`) {
  1193.         string $feedbackNode = `hyperGraph -query -feedbackNode $editor`;    
  1194.         if ($feedbackNode != "") {
  1195.             popupMenu -e -deleteAllItems $menu;
  1196.             string $gadget = `hyperGraph -query -feedbackGadget $editor`;
  1197.             string $cmd = "hypergraph"+$gadget+"Menu";
  1198.             if(`exists $cmd`) {
  1199.                 string $call = $cmd+"(\""+$editor+"\",\""+$menu+"\",\""+$feedbackNode+"\");";
  1200.                 eval $call;
  1201.             }else{
  1202.                 buildHGNodeMenuItems($editor,$menu);
  1203.             }
  1204.         } else {
  1205.             popupMenu -e -deleteAllItems $menu;
  1206.             buildMainPopupMenuItems($editor, $menu, $collectionName);
  1207.         }
  1208.     }        
  1209. }
  1210.  
  1211.  
  1212. global proc HyperGraphEdMenu(string $editor) 
  1213. {
  1214.     // Find the name of the control that the menu will be attached to
  1215.     //
  1216.     string $parent = `hyperGraph -query -control $editor`;
  1217.     string $popupMenuName = ($editor + "PopupMenu");
  1218.     string $collectionNameMenu = "Menu";
  1219.     string $collectionNamePopup = "Popup";
  1220.  
  1221.     // Create the popup menu
  1222.     //    
  1223.     if (!`popupMenu -exists $popupMenuName`) {
  1224.         string $fullMenuName = `popupMenu -parent $parent $popupMenuName`;
  1225.         popupMenu -e
  1226.             -parent $parent 
  1227.             -pmc ("buildHGMenuItems " + $editor + " " + $fullMenuName + " " + 
  1228.                   $collectionNamePopup)
  1229.             $popupMenuName;    
  1230.     }
  1231.     
  1232.     buildHyperGraphMenu $editor "hyperGraphMenu" $collectionNameMenu;
  1233.     defineButtonCommands $editor;
  1234. }
  1235.  
  1236. //
  1237. // Options
  1238. //
  1239. // Update menu options so that they reflect state of editor
  1240. //
  1241. global proc updateOptionsState(string $editor)
  1242. {
  1243.     if (`menuItem -exists PopupShapeNodesItem`)
  1244.         menuItem -e -cb `hyperGraph -q -showShapes $editor` 
  1245.                         PopupShapeNodesItem;
  1246.     if (`menuItem -exists MenuShapeNodesItem`)
  1247.         menuItem -e -cb `hyperGraph -q -showShapes $editor` 
  1248.                         MenuShapeNodesItem;    
  1249.  
  1250.     if (`menuItem -exists PopupInvisibleNodesItem`)
  1251.         menuItem -e -cb `hyperGraph -q -showInvisible $editor` 
  1252.                         PopupInvisibleNodesItem;
  1253.     if (`menuItem -exists MenuInvisibleNodesItem`)
  1254.         menuItem -e -cb `hyperGraph -q -showInvisible $editor` 
  1255.                         MenuInvisibleNodesItem;
  1256.  
  1257.     if (`menuItem -exists PopupExpressionsItem`)
  1258.         menuItem -e -cb `hyperGraph -q -showExpressions $editor` 
  1259.                         PopupExpressionsItem;
  1260.     if (`menuItem -exists MenuExpressionsItem`)
  1261.         menuItem -e -cb `hyperGraph -q -showExpressions $editor` 
  1262.                         MenuExpressionsItem;
  1263.  
  1264.     if (`menuItem -exists PopupConstraintsItem`)
  1265.         menuItem -e -cb `hyperGraph -q -showConstraints $editor` 
  1266.                         PopupConstraintsItem;
  1267.     if (`menuItem -exists MenuConstraintsItem`)
  1268.         menuItem -e -cb `hyperGraph -q -showConstraints $editor` 
  1269.                         MenuConstraintsItem;
  1270.  
  1271.     if (`menuItem -exists PopupDeformersItem`)
  1272.         menuItem -e -cb `hyperGraph -q -showDeformers $editor` 
  1273.                         PopupDeformersItem;
  1274.     if (`menuItem -exists MenuDeformersItem`)
  1275.         menuItem -e -cb `hyperGraph -q -showDeformers $editor` 
  1276.                         MenuDeformersItem;
  1277.  
  1278.     if (`menuItem -exists PopupImageEnabledItem`)
  1279.         menuItem -e -cb `hyperGraph -q -imageEnabled $editor` 
  1280.                         PopupImageEnabledItem;
  1281.     if (`menuItem -exists MenuImageEnabledItem`)
  1282.         menuItem -e -cb `hyperGraph -q -imageEnabled $editor` 
  1283.                         MenuImageEnabledItem;
  1284.  
  1285.     if (`menuItem -exists PopupUnderworldItem`)
  1286.         menuItem -e -cb `hyperGraph -q -showUnderworld $editor` 
  1287.                         PopupUnderworldItem;
  1288.     if (`menuItem -exists MenuUnderworldItem`)
  1289.         menuItem -e -cb `hyperGraph -q -showUnderworld $editor` 
  1290.                         MenuUnderworldItem;
  1291.  
  1292.     if (`menuItem -exists PopupUpdateSelectionItem`)
  1293.         menuItem -e -cb `hyperGraph -q -updateSelection $editor` 
  1294.                         PopupUpdateSelectionItem;
  1295.     if (`menuItem -exists MenuUpdateSelectionItem`)
  1296.         menuItem -e -cb `hyperGraph -q -updateSelection $editor` 
  1297.                         MenuUpdateSelectionItem;
  1298.  
  1299.     if (`menuItem -exists PopupUpdateNodeAddedItem`)
  1300.         menuItem -e -cb `hyperGraph -q -updateNodeAdded $editor` 
  1301.                         PopupUpdateNodeAddedItem;
  1302.     if (`menuItem -exists MenuUpdateNodeAddedItem`)
  1303.         menuItem -e -cb `hyperGraph -q -updateNodeAdded $editor` 
  1304.                         MenuUpdateNodeAddedItem;
  1305.  
  1306.  
  1307.     if (`radioMenuItemCollection -exists ($editor + "OrientMenuCollection")`) {
  1308.         menuItem -edit -rb 
  1309.             (`hyperGraph -q -orientation $editor` == "horiz") MenuHorizItem;
  1310.         menuItem -edit -rb 
  1311.             (`hyperGraph -q -orientation $editor` == "vert") MenuVertItem;
  1312.     }
  1313.  
  1314.     if (`radioMenuItemCollection -exists ($editor + "OrientPopupCollection")`) {
  1315.         menuItem -edit -rb 
  1316.             (`hyperGraph -q -orientation $editor` == "horiz") PopupHorizItem;
  1317.         menuItem -edit -rb 
  1318.             (`hyperGraph -q -orientation $editor` == "vert") PopupVertItem;
  1319.     }
  1320.  
  1321.     if (`radioMenuItemCollection -exists ($editor + "FreeformMenuCollection")`) {
  1322.         menuItem -edit -rb 
  1323.             (`hyperGraph -q -freeform $editor`) MenuFreeformOnItem;
  1324.         menuItem -edit -rb 
  1325.             (`hyperGraph -q -freeform $editor` == false) MenuFreeformOffItem;
  1326.     }
  1327.  
  1328.     if (`radioMenuItemCollection -exists ($editor + "FreeformPopupCollection")`) {
  1329.         menuItem -edit -rb 
  1330.             (`hyperGraph -q -freeform $editor`) PopupFreeformOnItem;
  1331.         menuItem -edit -rb 
  1332.             (`hyperGraph -q -freeform $editor` == false) PopupFreeformOffItem;
  1333.     }
  1334.     iconTextCheckBox -edit -value (`hyperGraph -q -freeform $editor`)
  1335.             freeformButton;
  1336. }
  1337.  
  1338.